import Vue from "vue";
import VueRouter from "vue-router";
import login from "@/pages/users/login";
import regist from "@/pages/users/regist";
import admin_home from "@/pages/admin/admin_home";
import admin_userControl from "@/pages/admin/admin_userControl";
import admin_goodsControl from "@/pages/admin/admin_goodsControl";
import home from "@/pages/home";
import personal from "../pages/users/personal.vue";
import recovery from "../pages/recovery"
import searchGoods from "../pages/goods/searchGoods"
import goodsDetail from "../pages/goods/goodsDetail"
import price from "../pages/price"
import myOrder from "../pages/orders/myOrder"
import publish from "../pages/goods/publish"
import concern from "../pages/goods/concern"

Vue.use(VueRouter);

const routes = [{
        path: "/",
        name: "home",
        component: home,
    },
    {
        path: "/login",
        name: "login",
        component: login,
    },
    {
        path: "/personal",
        name: "personal",
        component: personal,
    },
    {
        path: "/regist",
        name: "Regist",
        component: regist,
    },
    {
        path: "/admin_home",
        name: "Admin_home",
        component: admin_home,
        redirect: "/admin_userControl",
        children: [{
                path: "/admin_userControl",
                component: admin_userControl,
            },
            {
                path: "/admin_goodsControl",
                component: admin_goodsControl,
            },
        ],
    },
    {
        path: "/recovery",
        name: "recovery",
        component: recovery,
    },
    {
        path: "/searchGoods",
        name: "searchGoods",
        component: searchGoods,
    },
    {
        path: "/goodsDetail/:gid",
        name: "goodsDetail",
        component: goodsDetail,
    }, {
        path: "/price",
        component: price
    },
    {
        path: "/myOrder",
        component: myOrder,
    }, {
        path: "/publish",
        component: publish,
    }, {
        path: "/concern",
        component: concern,
    }
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});

export default router;